cmake_minimum_required(VERSION 3.16)

project(dota683lobby VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTORCC ON)

find_package(Qt6 REQUIRED COMPONENTS Quick)

qt_standard_project_setup(REQUIRES 6.5)

qt_add_executable(appdota683lobby
    main.cpp
)

qt_add_qml_module(appdota683lobby
    URI dota683lobby
    VERSION 1.0
    QML_FILES
        Main.qml
        RESOURCES pics.qrc
        SOURCES steamapibackend.h steamapibackend.cpp
        RESOURCES build/Desktop_Qt_6_8_1_MinGW_64_bit-Debug/steam_appid.txt
        SOURCES avatarimageprovider.h avatarimageprovider.cpp
        SOURCES friendmodel.h friendmodel.cpp
        SOURCES friend.h friend.cpp
        SOURCES lobbymodel.h lobbymodel.cpp
        SOURCES friendimageprovider.h friendimageprovider.cpp
        SOURCES lobbyimageprovider.h lobbyimageprovider.cpp
        SOURCES gamehistorymodel.h gamehistorymodel.cpp
        SOURCES gamehistory.h gamehistory.cpp
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appdota683lobby PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appdota683lobby
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appdota683lobby
    PRIVATE Qt6::Quick
    PUBLIC ${PROJECT_SOURCE_DIR}/sdk/redistributable_bin/steam_api.lib
    PUBLIC ${PROJECT_SOURCE_DIR}/sdk/redistributable_bin/win64/steam_api64.lib
)

include(GNUInstallDirs)
install(TARGETS appdota683lobby
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/ahks)
file(COPY_FILE ${CMAKE_SOURCE_DIR}/ahks/launch_dota2.exe ${CMAKE_BINARY_DIR}/ahks/launch_dota2.exe)
